﻿using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace MadearteNovo.Site.Pages
{
    public partial class Portas : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            DirectoryInfo dInfo = new DirectoryInfo(Server.MapPath("~/Imagens/Portas2"));
            DataTable dt = new DataTable();
            dt.Columns.Add("Link");
            dt.Columns.Add("Url");
            dt.Columns.Add("Codigo");

            foreach (var arquivo in dInfo.GetFiles())
            {
                string link = arquivo.Name;

                dt.Rows.Add(
                    "javascript:lightbox(\"" + link + "\", \"portas\"); return false;",
                    ResolveUrl("/Imagens/Portas2/" + arquivo.Name),
                    arquivo.Name.Substring(0, arquivo.Name.IndexOf(".")));
            }

            rptPortas.DataSource = dt;
            rptPortas.DataBind();
        }
    }
}